package com.kele.goods;

import java.util.function.*;

public class MainTest2 {

    public static void main(String[] args) {
        test1();
    }

    public static void test1(){
        //Function 传入参数，返回参数
        BiFunction<Integer,Integer,String>  add = (a,b)->{return (a+""+b);};
        String apply = add.apply(1, 2);
        System.out.println(apply);

        Function<Integer,Integer> square = a->a*a;
        System.out.println(square.apply(5));

        //Consumer
        Consumer<String> consumer = (a)->{
            System.out.println(a);
        };
        consumer.accept("abcd");

        //Predicate
        Predicate<String> predicate = (a)->{return "aaa".equals(a);};
        System.out.println(predicate.test("aaabbb"));
        //Supplier
        Supplier<String> supplier = ()->{return "1905A";};

        System.out.println(supplier.get());

    }
}


